// 引入request
import request from '@/utils/request.js'

// 封装获取面经列表方法
export const getArticleList = (current = 1, pageSize = 10, sorter = null) => {
  return request.get('/h5/interview/query', {
    params: {
      current: current,
      pageSize: pageSize,
      sorter: sorter
    }
  })
}

// 封装获取面经收藏和喜欢方法
export const getCollectOrLike = (params) => {
  return request.get('/h5/interview/opt/list', { params })
}

// 封装获取单个面经详情
export const getArticleDetail = (id) => {
  return request.get('/h5/interview/show', { params: { id } })
}

// 封装点赞和收藏
export const toggleCollectOrLike = (id, optType) => {
  return request.post('/h5/interview/opt', { id, optType })
}
